import request from '@/utils/request'
import type { Attr } from './type'
enum API {
    CATEGORY_LIST_1_API = '/admin/product/getCategory1',
    CATEGORY_LIST_2_API = '/admin/product/getCategory2',
    CATEGORY_LIST_3_API = '/admin/product/getCategory3',
    CATEGORY_ATTR_LIST_API = '/admin/product/attrInfoList',
    CATEGORY_ADD_EDIT_API = '/admin/product/saveAttrInfo',
    CATEGORY_DELETE_API = '/admin/product/deleteAttr'
}
export const reqCategoryList1 = () => request.get<any, any>(API.CATEGORY_LIST_1_API)
export const reqCategoryList2 = (category1Id: number) => request.get<any, any>(API.CATEGORY_LIST_2_API + `/${category1Id}`)
export const reqCategoryList3 = (category2Id: number) => request.get<any, any>(API.CATEGORY_LIST_3_API + `/${category2Id}`)
export const reqCategoryAttrList = (category1Id: number, category2Id: number, category3Id: number) => 
    request.get<any, any>(API.CATEGORY_ATTR_LIST_API + `/${category1Id}/${category2Id}/${category3Id}`)
export const reqCategoryAddEdit = (data:Attr) => request.post<any, any>(API.CATEGORY_ADD_EDIT_API,data)
export const reqCategoryDelete = (attrId: number) => request.delete<any, any>(API.CATEGORY_DELETE_API + `/${attrId}`)








